{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "6f42262a",
   "metadata": {},
   "source": [
    "* 2022/9/5/week3\n",
    "* Python学习心得"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "c435e38c",
   "metadata": {},
   "source": [
    "# 本期学习目标\n",
    "> 1. 模块 \n",
    "> 2. 变量 \n",
    "> 3. 循环变量"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "4ee4d917",
   "metadata": {},
   "source": [
    "# 1.模块"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "1bf40ae5",
   "metadata": {},
   "source": [
    "## 1.1模块 ([标准库] )\n",
    "\n",
    "> Python创始人团队为后面使用这门编程语言的人们提供的解决日常生活可能使用到的功能,而制作的可以方便使用的模块\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "92d97ad9",
   "metadata": {},
   "outputs": [],
   "source": [
    "import time"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "6dff46d3",
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "1662346484.0107803"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 纪元 (1970.1.1)\n",
    "# 时间戳\n",
    "time.time()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "da1b862e",
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "1662345959.729803"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "time.time()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "64f7cb8f",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "time.struct_time(tm_year=2022, tm_mon=9, tm_mday=5, tm_hour=10, tm_min=48, tm_sec=26, tm_wday=0, tm_yday=248, tm_isdst=0)"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "time.localtime()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "363b0789",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "time.struct_time(tm_year=2022, tm_mon=9, tm_mday=5, tm_hour=2, tm_min=48, tm_sec=9, tm_wday=0, tm_yday=248, tm_isdst=0)"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "time.gmtime()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "dc4e2a3b",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'Mon Sep  5 10:54:17 2022'"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "time.asctime(time.localtime())"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "35f0f288",
   "metadata": {},
   "source": [
    "## 1.2模块 (开源模块)\n",
    "\n",
    "> 1. 因为代码开源\n",
    "> 2. 集合全领域(全人类)的需求 \n",
    "> 3. 按照国际标准开放的标准库 \n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "d0ab0ecb",
   "metadata": {},
   "source": [
    "## 1.3模块(自定义模块)\n",
    "> 1. 不愿意开源的有一定知识产权的(开放API租用形式开放)\n",
    "> 2. 自己用的,写的也不怎么好,开源出去丢人的."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "3593f3b7",
   "metadata": {},
   "source": [
    "# 2.变量\n",
    "\n",
    "> 1. 声明变量（命名）规则\n",
    ">> 1. 变量名只能是字母、数字或下划线的任意组合\n",
    ">> 2. 变量名的第一个字符不能是数字\n",
    ">> 3. 以下关键字不能声明为变量名\n",
    "    ['and',"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "id": "9270e698",
   "metadata": {},
   "outputs": [],
   "source": [
    "网二_01 =\"Xiao Hong\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "53a7132a",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'Xiao Hong'"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "网二_01"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "id": "70c08edc",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "75051280"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "id(网二_01)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "id": "4ea1526e",
   "metadata": {},
   "outputs": [],
   "source": [
    "网二_01_age = 19"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "id": "93b89ab8",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "19"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "网二_01_age"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "id": "39af03ba",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "210000001 210000001\n",
      "210000006 210000001\n"
     ]
    }
   ],
   "source": [
    "# 案例（关于变量）\n",
    "\n",
    "网二_01_ID = \"210000001\"\n",
    "\n",
    "网二_02_ID = 网二_01_ID\n",
    "\n",
    "print(网二_01_ID,网二_02_ID)\n",
    "\n",
    "网二_01_ID = \"210000006\"\n",
    "\n",
    "print(网二_01_ID,网二_02_ID)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "43daa3ee",
   "metadata": {},
   "source": [
    "# 课后作业\n",
    "\n",
    "* 课本P4项目练习（写一遍运行成功）\n",
    "* 思考 if 是什么？\n",
    "* 思考 from 是什么？"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "8394a5d5",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Not an add minute.\n"
     ]
    }
   ],
   "source": [
    "from datetime import datetime\n",
    "\n",
    "odds = {1,3,5,7,9,11,13,15,17,19,21,23,25,27,29,31,33,35,37,39,41,43,45,47,49,51,53,55,57,59}\n",
    "\n",
    "right_this_minute = datetime.today().minute\n",
    "\n",
    "if right_this_minute in odds:\n",
    "    print(\"this minute seems a little odd.\")\n",
    "else:\n",
    "    print(\"Not an add minute.\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "0e80e536",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.12"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
